/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lcfgly.DatabaseFactory;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

/**
 *
 * @author lcfgly
 */
@Component("databaseshoprice")
public class DatabaseForShoprice implements DataFactoryInterface{
   
    private final DataFactory dataFactory;
    
    @Autowired
    public DatabaseForShoprice(@Qualifier("jdbcTemple") JdbcTemplate jdbcTemplate) {
        this.dataFactory=new DataFactory(jdbcTemplate);
    }

    @Override
    public int delete(String table, String keyname, Object... key) throws SQLException {
        return dataFactory.delete(table, keyname, key);
    }

    @Override
    public int delete_list(String table, String keyname, Object... keys) throws SQLException {
        return dataFactory.delete_list(table, keyname, keys);
    }

    @Override
    public <T> int insert(T object, String table) throws SQLException {
        return dataFactory.insert(object, table);
    }

    @Override
    public <T> int insertBackID(T object, String table) throws SQLException {
        return dataFactory.insertBackID(object, table);
    }

    @Override
    public <T> int[] insert_list(List<T> args, String table) throws SQLException {
        return dataFactory.insert_list(args, table);
    }

    @Override
    public <T> int update(String table, T object, String keyname, Object... key) throws SQLException {
        return dataFactory.update(table, object, keyname, key);
    }

    @Override
    public <T> T one(Class<T> classtype,String sql, Object... args) throws SQLException {
        return dataFactory.one(classtype,sql, args);
    }

    @Override
    public <T> List<T> rows(Class<T> classtype,String sql, Object... args) throws SQLException {
        return dataFactory.rows(classtype,sql, args);
    }
    
    @Override
    public List rowsWithOutObject(String sql, Object... args) throws SQLException {
        return dataFactory.rowsWithOutObject(sql, args);
    }

    @Override
    public Map oneWithOutObject(String sql, Object... args) throws SQLException {
        return dataFactory.oneWithOutObject(sql, args);
    }

    @Override
    public int Getrowsnum(String sql, Object... args) throws SQLException {
        return dataFactory.Getrowsnum(sql, args);
    }

    @Override
    public Map Page(Class classtype, String sql, int rowsnum, int page, int pagecount, Object... args) throws SQLException {
        return dataFactory.Page(classtype, sql, rowsnum, page, pagecount, args);
    }
    
}
